1. Technical Field
The exemplary embodiments of the invention are generally related to an improved data processing system. More specifically, the exemplary embodiments of the invention are directed to a method and system for generating a complete controller specification using controller overlays for defining an application.
2. Description of Related Art
The Model-View-Controller (MVC) is a known architecture for specifying the operation of an application and its representation via a graphical user interface (GUI). The MVC paradigm is a way of breaking an application, or even just a portion of an application's interface, into three parts: the model, the view, and the controller. MVC was originally developed to map the traditional input, processing, output roles into the GUI realm. The user input, the modeling of the external world, and the visual feedback to the user are separated and handled by model, view and controller components. For example, the controller interprets mouse and keyboard inputs from the user and converts these user actions into commands that are sent to the model and/or view components to effect the appropriate change. The model manages one or more data elements, responds to queries about its state, and responds to instructions that change state. The view component manages the display and presentation of data to the user through a combination of graphics and text.
Model components, which are typically generated as model objects in an object-oriented environment, represent special knowledge and expertise. The model objects hold an application's data and define the logic that manipulates that data. A well-designed MVC application has all its important data encapsulated in model objects. Any data that is part of the persistent state of the application (whether that persistent state is stored in files, databases, etc.) reside in the model objects once the data is loaded into the application.
Ideally, a model object has no connection to the user interface used to present and edit it. For example, if a model object represents a person, it may be desirable to store the person's birth date in the person model object. However, storing a date format string or other information on how that date is to be presented is better off in a different portion of the MVC architecture than the model object. In general, a model object should not be concerned with interface and presentation issues.
A view object knows how to display and possibly edit data from the application's model. The view should not be responsible for storing the data it is displaying. A view object can be in charge of displaying just one part of a model object, or a whole model object, or even many different model objects. View objects tend to be reusable. That is, the same view object may be used in a plurality of different applications to generate similar view components in a graphical user interface.
The controller object acts as the intermediary between the application's view objects and its model objects. Typically, controller objects have logic in them that is specific to an application. Controllers are often in charge of making sure the views have access to the model objects they need to display and often act as the conduit through which views learn about changes to the model.
By confining application-specific code to controller objects, model and view objects are more general and reusable. Controllers are often the least reusable objects in an application. The controller objects frequently contain many lines of code. To make this quantity of code more manageable, it is sometimes useful to separate controller objects into “model controllers” and “view controllers.”
A model controller is a controller that concerns itself mostly with the model layer. Its primary responsibilities are to manage the model and communicate with any view controller objects. Action methods that apply to the model as a whole will typically be implemented in a model controller.
A view controller is a controller that concerns itself mostly with the view layer. Its primary responsibilities are to manage the interface and communicate with the model controller. Action methods concerned with data displayed in a view will typically be implemented in a view controller.
Thus, in known MVC architecture based systems, applications are broken into three layers of abstraction for ease in developing and specifying these applications. These three layers are the model layer, the view layer and the controller layer.